<?php
namespace App\Repository;

use App\Model\MallShop;

class MallShopRepository extends \HyperfStore\Repository
{
    // 放入模型
    public function build()
    {
        return new MallShop;
    }
    
    // 创建
    public function create(UserRepository $user, $data)
    {
        $this->model->user()->associate($user->model());
        
        return $this->save($data);
    }
    
    // 检查状态
    public function statusOk()
    {
        return $this->model->status == MallShop::STATUS_OK;
    }
}